import React from 'react';
import Layout from '../../components/Layout';
import { RouteConfig } from './remaining';

// 懒加载商城组件
const MallProduct = React.lazy(() => import('../../views/Mall/Product'));
const MallOrder = React.lazy(() => import('../../views/Mall/Order'));
const MallPromotion = React.lazy(() => import('../../views/Mall/Promotion'));

const mallRoutes: RouteConfig[] = [
  {
    path: '/mall',
    element: <Layout />,
    children: [
      {
        path: 'product',
        element: <MallProduct />,
        meta: {
          title: '商品管理',
          icon: 'product',
          noCache: false
        }
      },
      {
        path: 'order',
        element: <MallOrder />,
        meta: {
          title: '订单管理',
          icon: 'order',
          noCache: false
        }
      },
      {
        path: 'promotion',
        element: <MallPromotion />,
        meta: {
          title: '促销活动',
          icon: 'promotion',
          noCache: false
        }
      }
    ],
    meta: {
      title: '商城管理',
      icon: 'shop',
      noCache: false
    }
  }
];

export default mallRoutes;